/*
    https://wangdoc.com/javascript/types/general.html
    数据类型-概述
*/

// primitive type
typeof 123;    // number
typeof '123';  // string
typeof false;  // boolean

// complex type
typeof function f() {};    // function
typeof window; // run in Browser is object, run in here is undefined
typeof {}; // object
typeof [];  // object

// special value
typeof undefined; // undefined
typeof null; // object

// ReferenceError: v is not defined, use typeof can avoid it
typeof v;

// wrong
// if (v) {
//     // ...
// }

// right
if (typeof v === 'undefined') {
    // ...
    console.log("v is undefined!")
}